<%include file="include/head.html"%>
<div class="wrapper">
  <div id="div-home" class="main-info-box">
    <%include file="include/crumbs.html"%>
    <%include file="include/edit_nav.html"%>
    <div class="div-info-body">
      <div id="family-links">
	<a href="/family/manage">返回列表</a>
	<a href="/family/edit?fami_id=<%$family.id%>">编辑</a>
      </div>

      <%if $family%>
      <form action="/family/edit" method="post">
	<input type="hidden" name="id" value="<%$family.id%>"/>
	<dl id="dl-family-info">
	  <dt>省：</dt>
	  <dd>
	    <select required class="required" id="province_id">
	      <%$provinces%>
	    </select>
	  </dd>
	  <dt>市：</dt>
	  <dd>
	    <select id="city_id">
	      <%$cities%>
	    </select>
	  </dd>
	  <dt>县：</dt>
	  <dd>
	    <select id="town_id">
	      <%$towns%>
	    </select>
            <input name="region_code" type="hidden" id="city_code" value="<%$family.region_code%>"/>
	  </dd>
	  <!-- <dt>地区：</dt> -->
	  <!-- <dd><%$family.region_name%></dd> -->
	  <dt>名称：</dt>
	  <dd>
            <input required class="required" maxlength="24" type="text" name="name" value="<%$family.name%>"/>
	  </dd>
	  <dt>备注：</dt>
	  <dd>
            <textarea name="notes" maxlength="128"><%$family.notes%></textarea>
	  </dd>
	  <dt>代表人物：</dt>
	  <dd><%$family.master_name%></dd>
	  <dt>创建者：</dt>
	  <dd><%$family.creator_name%></dd>
          <dt>开放：</dt>
          <dd>
	    <%if $open|@count gt 0%>
	    <%foreach from=$open key=k item=v%>		
	    <label><input type="radio" required class="required" name="open" id="<%$k%>" value="<%$k%>" 
			  <% if (!$family.open && $k eq "public") || $family.open eq $k %>checked<%/if%> /><%$v%></label>
	    <%/foreach%>
	    <%/if%>
	    <!-- <label><input type="radio" required class="required" name="open" id="public" value="<%$public%>" <% if !$family.open || $family.open eq $public %>checked<%/if%> />对其他人开放</label> -->
	    <!-- <label><input type="radio" name="open" id="private" value="<%$private%>" <% if $family.open eq $private %>checked<%/if%> />仅自己可看</label> -->
	  </dd>

          <dt>&nbsp;</dt>
          <dd>
            <input type="submit" value="提交"/>
	  </dd>
	</dl>
      </form>
      <%else%>
      not found family data, please retry
      <%/if%>
    </div>
  </div>
</div>
<%include file="include/bottom.html"%>
